package com.hzit.user.controller;

import com.hzit.user.service.IUserService;
import com.hzit.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.ReactiveTransaction;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author wf
 * @since 2024-02-29
 */
@RestController
@RequestMapping("/user")
public class UserController {

	@Autowired
	private IUserService userService;
	@Value("${hzit.student.sname}")
	private String sname;
	@Value("${server.port}")
	private int port;
	//1. 查询所有用户
	@GetMapping("/list")
	public R list(){
		Map map = new HashMap<>();
		map.put("port",port);
		map.put("list",userService.list());
		return R.ok(map);
	}
	//2. 读取共享配置
	@GetMapping("/readconfig")
	public R readconfig(){
		return R.ok(sname);
	}
}
